package in.abacritt.android.xclock;

import android.content.Context;

public class OpenWeatherClient {
	WeatherInfo currentWeatherInfo;
	LocationInfoWrapper currentLocation;
	Context appContext;

	public OpenWeatherClient(Context appContext) {
		this.appContext = appContext;
	}

	public WeatherInfo getCurrentWeather() {
		getCurrentLocation();
		getWeatherForCurrentLocation();

		return currentWeatherInfo;
	}

	private void getWeatherForCurrentLocation() {
		currentWeatherInfo = new OpenWeatherParser(currentLocation)
				.parseCurrentWeather();

	}

	private void getCurrentLocation() {
		XClockLocationClient locationClient = new XClockLocationClient(
				appContext);

		currentLocation = locationClient.getCurrentLocation();
	}
}
